// AC自动机模版(简单版)
// 测试链接 ：https://www.luogu.com.cn/problem/P3808
// 相关帖子 ：https://www.cnblogs.com/dx123/p/16151895.html
// 相关帖子 ：https://oi-wiki.org/ds/fenwick/
// 提交以下的code，可以直接通过


#include <bits/stdc++.h>

using namespace std;

const int MAXN = 1000001;
char str[MAXN];
int tree[MAXN][26];
int fail[MAXN];
int q[MAXN];
int times[MAXN];
int cnt = 0, n;

inline int read()
{
    char ch = getchar();
    int x = 0, f = 1;
    while(ch < '0' || ch > '9')
    {
        if(ch == '-') f = -1;
        ch = getchar();
    }
    while(ch >= '0' && ch <= '9')
    {
        x = 10 * x + ch - '0';
        ch = getchar();
    }
    return f * x;
}

void insert(char* s)
{
    int u = 0, n = strlen(s);
    for(int i = 0, ch; i < n; ++i)
    {
        ch = s[i] - 'a';
        if(tree[u][ch] == 0) tree[u][ch] = ++cnt;
        u = tree[u][ch];
    }
    ++times[u];
}

void setFail()
{
    int l = 0, r = 0;
    for(int i = 0; i <= 25; ++i)
    {
        if(tree[0][i]) q[r++] = tree[0][i];
    }
    while(l < r)
    {
        int u = q[l++];
        for(int i = 0; i <= 25; ++i)
        {
            if(tree[u][i] == 0)
            {
                tree[u][i] = tree[fail[u]][i];
            }
            else
            {
                fail[tree[u][i]] = tree[fail[u]][i];
                q[r++] = tree[u][i];
            }
        }
    }
}

int query(char* s)
{
    int ans = 0;
    for(int i = 0, k = 0; s[k]; ++k)
    {
        i = tree[i][s[k] - 'a'];
        for(int j = i; j && ~times[j]; j = fail[j])
        {
            ans += times[j];
            times[j] = -1;
        }
    }
    return ans; 
}

int main()
{
    n = read();
    for(int i = 0; i < n; ++i)
    {
        scanf("%s", str);
        insert(str);
    }
    setFail();
    scanf("%s", str);
    printf("%d\n", query(str));

    return 0;
}